<?php

use App\Models\AdminPermission;
use App\Models\Admin;
use App\Models\Permission;
use Illuminate\Database\Seeder;

class AdminPermissionsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $admin = Admin::create([
            'name'     => 'bluestone',
            'email'    => 'bluestone@bluestoneapp.com',
            'password' => bcrypt('stone123'),
        ]);

        $adminPermissions = [
            [
                // 后台权限
                'permission_id' => Permission::create([
                    'name'        => 'permission module',
                    'description' => '后台权限模块',
                ])->id,
                'admin_id'      => $admin->id,
            ],
        ];

        AdminPermission::insert($adminPermissions);

        echo "-------------------\n";
        echo "增加权限系统数据\n";
        echo "-------------------\n";
    }
}
